module rad_hshm_mod

  use rad_types_mod
  use rad_funcs_mod

  implicit none

  private

  public rad_hshm_init
  public rad_hshm_run
  public rad_hshm_final

  type rad_hshm_conf_type
    integer :: nup  = 0
    integer :: ndn  = 0
    integer :: ng   = 0
    integer :: nstr = 0
  end type rad_hshm_conf_type

  type(rad_hshm_conf_type) conf

  namelist /rad_hshm_control/ &
    conf%nup,                 &
    conf%ndn,                 &
    conf%ng

contains

  subroutine rad_hshm_init(namelist_file, nlev, nup, ndn, ng)

    character(*), intent(in) :: namelist_file
    integer, intent(in) :: nlev
    integer, intent(in), optional :: nup
    integer, intent(in), optional :: ndn
    integer, intent(in), optional :: ng

    open(10, file=namelist_file, status='old')
    read(10, nml=rad_hshm_control)
    close(10)

    if (conf%nup == 0 .and. present(nup)) conf%nup = nup
    if (conf%ndn == 0 .and. present(ndn)) conf%ndn = ndn
    if (conf%ng  == 0 .and. present(ng )) conf%ng  = ng

    conf%nstr = conf%nup + conf%ndn

  end subroutine rad_hshm_init

  subroutine rad_hshm_run(input, ouput)

    type(rad_input_type), intent(in) :: input
    type(rad_output_type), intent(inout) :: output

  end subroutine rad_hshm_run

  subroutine rad_hshm_final()

  end subroutine rad_hshm_final

end module rad_hshm_mod
